import fetch from '@/utils/fetch'

/* 代理商 */

// 获取省市区
export function getArea(params = {}) {
  return fetch({
    url: '/espier/address',
    method: 'get',
    params: params
  })
}
// 代理商列表
export function getTheAgentList(params) {
  return fetch({
    url: `/agents/list`,
    method: 'get',
    params
  })
}
// 代理商下拉列表
export function getAgentSelList(params) {
  return fetch({
    url: `/merchant/agent/list`,
    method: 'get',
    params
  })
}
// 添加代理商
export function addTheAgent(params, id) {
  return fetch({
    url: `/agents/add${id ? `/${id}` : ''}`,
    method: 'post',
    params
  })
}
// 更新代理商
export function updateTheAgent(params) {
  return fetch({
    url: `/agents/update`,
    method: 'post',
    params
  })
}
// 获取代理商详情
export function getTheAgent(params, id) {
  return fetch({
    url: `/agents/${id}`,
    method: 'get',
    params
  })
}

// 删除代理商
export const deleteAgent = (id) => {
  return fetch({
    url: `/agents/${id}`,
    method: 'delete'
  })
}
// 代理商分配区域保存
export function saveAgentArea(params) {
  return fetch({
    url: `/agents/area/save`,
    method: 'post',
    params
  })
}
// 获取指定代理商分配区域列表
export function getAgentAreaList(params) {
  return fetch({
    url: `/agents/area/list`,
    method: 'get',
    params
  })
}
// 修改代理商的状态
export function updateAgentStatus(params) {
  return fetch({
    url: `/agents/brokerage/status`,
    method: 'post',
    params
  })
}
// 获取代理商佣金列表
export function getAgentBrokeragelist(params) {
  return fetch({
    url: `/agents/brokerage/list`,
    method: 'get',
    params
  })
}
// 佣金提现
export function agentsWithdrawal(params) {
  return fetch({
    url: `/agents/withdrawal`,
    method: 'post',
    params
  })
}
// 佣金提现记录
export function getAgentsWithdrawalList(params) {
  return fetch({
    url: `/agents/cash/withdrawal`,
    method: 'get',
    params
  })
}
// 代理商佣金列表统计数据
export function getAgentsBrokerageStatistics(params) {
  return fetch({
    url: `/agents/brokerage/statistics`,
    method: 'get',
    params
  })
}
// 代理商绑定会员
export function agentsBindMember(params) {
  return fetch({
    url: `/agents/member`,
    method: 'post',
    params
  })
}


